package com.ylx.demo.consumer;

import com.ylx.demo.pojo.UserMessage;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;

@Component
public class UserMessageConsumer {
    /**
     * 注解描述，当前方法要监听的topic和当前consumer所属的group
     *
     * @param message 处理消息对象
     */
    @KafkaListener(topics = "userTopic", groupId = "user-consumer")
    public void onMessage(UserMessage message) {
        System.out.println(message);
    }
}
